<html>
<head><meta charset="utf-8"><title>change rustc_args_required_const to per arg attribute · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html">change rustc_args_required_const to per arg attribute</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="191355650"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191355650" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Vossen <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191355650">(Mar 21 2020 at 17:05)</a>:</h4>
<p>Hey all,</p>
<p>I am currently working on <a href="https://github.com/rust-lang/rust/issues/69282" target="_blank" title="https://github.com/rust-lang/rust/issues/69282">69282</a> which changes <code>#[rustc_args_required_const]</code> to a per argument attribute (implemented <a href="https://github.com/rust-lang/rust/pull/60669" target="_blank" title="https://github.com/rust-lang/rust/pull/60669">here</a>).</p>
<p>I was talking to <span class="user-mention" data-user-id="123856">@Vadim Petrochenkov</span>  and he suggested reaching out to you about the best way to encode a argument attribute in the MIR. He suggested maybe a boolean flag specifically for this rustc_required_const instead of encoding all attributes.</p>



<a name="191371068"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191371068" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191371068">(Mar 21 2020 at 23:48)</a>:</h4>
<p>why do we want this to affect MIR?</p>



<a name="191371080"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191371080" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191371080">(Mar 21 2020 at 23:49)</a>:</h4>
<p>I was under the impression <code>rustc_args_required_const</code> was always a temporary hack — we can achieve the same thing with const generics, so we shouldn't special-case too much to support it</p>



<a name="191373491"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191373491" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191373491">(Mar 22 2020 at 01:07)</a>:</h4>
<p><span class="user-mention" data-user-id="246502">@jakevossen5</span> You need to access this from <em>outside</em> the function, not from the MIR body (which is the "inside" of the function, so the speak)</p>



<a name="191373542"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191373542" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191373542">(Mar 22 2020 at 01:09)</a>:</h4>
<p><span class="user-mention" data-user-id="246502">@jakevossen5</span> the most important part is how you can detect this cross-crate. locally you can just look at the HIR, but cross-crate is the hard part, and if you do that right then you'll end up with a query which you can implement locally too (and encoding the cross-crate data would just use the query)</p>



<a name="191373545"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191373545" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191373545">(Mar 22 2020 at 01:09)</a>:</h4>
<p>probably a decent way to do it would be like this <a href="https://github.com/rust-lang/rust/blob/master/src/librustc_metadata/rmeta/mod.rs#L330" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/librustc_metadata/rmeta/mod.rs#L330">https://github.com/rust-lang/rust/blob/master/src/librustc_metadata/rmeta/mod.rs#L330</a></p>



<a name="191373673"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191373673" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191373673">(Mar 22 2020 at 01:12)</a>:</h4>
<p>left this comment <a href="https://github.com/rust-lang/rust/issues/69282#issuecomment-602130836" target="_blank" title="https://github.com/rust-lang/rust/issues/69282#issuecomment-602130836">https://github.com/rust-lang/rust/issues/69282#issuecomment-602130836</a></p>



<a name="191390244"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191390244" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191390244">(Mar 22 2020 at 10:31)</a>:</h4>
<p>How hard would it be to turn <code>rustc_required_const</code> into real const generics when desugaring to HIR? That would make <a href="https://github.com/bjorn3/rustc_codegen_cranelift/issues/666" target="_blank" title="https://github.com/bjorn3/rustc_codegen_cranelift/issues/666">bjorn3/rustc_codegen_cranelift#666</a> much easier to implement.</p>



<a name="191391006"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191391006" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191391006">(Mar 22 2020 at 10:53)</a>:</h4>
<p>FYI I use the same mechanism as <code>rustc_required_const</code> for <code>const</code> operands to inline assembly.</p>



<a name="191391063"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191391063" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191391063">(Mar 22 2020 at 10:55)</a>:</h4>
<p>... which means that my code is currently broken since it also assumes that the MIR resolves to a constant...</p>



<a name="191391182"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191391182" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191391182">(Mar 22 2020 at 10:59)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> Have you tried calling <code>eval_mir_constant</code>? <a href="https://github.com/rust-lang/rust/pull/69171/files#diff-a5b7af844d26b58c2c9537372b100c90R938" target="_blank" title="https://github.com/rust-lang/rust/pull/69171/files#diff-a5b7af844d26b58c2c9537372b100c90R938">https://github.com/rust-lang/rust/pull/69171/files#diff-a5b7af844d26b58c2c9537372b100c90R938</a></p>



<a name="191391413"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191391413" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191391413">(Mar 22 2020 at 11:05)</a>:</h4>
<p>Yes, I am using <code>eval_mir_constant</code>. The problem is that for example <code>_mm256_extract_epi64</code> is a single function, that is codegened a single time without being specialized on the imm8 argument. However the <code>simd_extract</code> intrinsic needs to know the value of imm8 at during codegen. With cg_llvm this is not a problem, as it only needs to have a known value after inlining and other optimizations, but clif ir treats it as a real immediate, so you can't pass a value that will be known after optimizations.</p>



<a name="191391670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191391670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191391670">(Mar 22 2020 at 11:12)</a>:</h4>
<p>Ah I see. Does <code>#[inline(always)]</code> force MIR inlining?</p>



<a name="191391692"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191391692" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191391692">(Mar 22 2020 at 11:13)</a>:</h4>
<p>(deleted)</p>



<a name="191391787"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191391787" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191391787">(Mar 22 2020 at 11:15)</a>:</h4>
<p>No, unfortunately not.</p>
<ol>
<li>MIR inlining is only enabled at mir-opt-level&gt;=2</li>
<li>MIR inlining is skipped in many cases to prevent potential cycles during inlining</li>
<li>MIR inlining has some bugs, so I can't enable it by default in cg_clif</li>
</ol>



<a name="191394126"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191394126" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191394126">(Mar 22 2020 at 12:19)</a>:</h4>
<p>wait how does that even work</p>



<a name="191394138"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191394138" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191394138">(Mar 22 2020 at 12:19)</a>:</h4>
<p>is <code>simd_extract</code> being used by <code>_mm256_extract_epi64</code> with only the latter having <code>#[rustc_args_required_const]</code>?</p>



<a name="191394181"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191394181" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191394181">(Mar 22 2020 at 12:20)</a>:</h4>
<p>because that's scary, intrinsics should be correctly annotated</p>



<a name="191394190"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191394190" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191394190">(Mar 22 2020 at 12:20)</a>:</h4>
<p>IIRC I was told this wouldn't be allowed to happen</p>



<a name="191394201"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191394201" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191394201">(Mar 22 2020 at 12:21)</a>:</h4>
<p>uhhhh ohhhhhhhh <a href="https://doc.rust-lang.org/src/core/up/stdarch/crates/core_arch/src/x86_64/avx2.rs.html#28-30" target="_blank" title="https://doc.rust-lang.org/src/core/up/stdarch/crates/core_arch/src/x86_64/avx2.rs.html#28-30">https://doc.rust-lang.org/src/core/up/stdarch/crates/core_arch/src/x86_64/avx2.rs.html#28-30</a></p>



<a name="191394204"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191394204" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191394204">(Mar 22 2020 at 12:21)</a>:</h4>
<p>so we stabilized functions like this?!</p>



<a name="191394259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191394259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191394259">(Mar 22 2020 at 12:22)</a>:</h4>
<p><span class="user-mention" data-user-id="143274">@Amanieu</span> <span class="user-mention" data-user-id="133247">@bjorn3</span> the only correct thing to do, IMO, would be to force <code>#[rustc_args_required_const(...)]</code> to be applied to an intrinsic, and to make all of the users of the attribute intrinsics</p>



<a name="191394263"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191394263" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191394263">(Mar 22 2020 at 12:23)</a>:</h4>
<p>note that your inline assembly should be fine, and so should intrinsics</p>



<a name="191394271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191394271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191394271">(Mar 22 2020 at 12:23)</a>:</h4>
<p>it's only functions where it doesn't make much sense</p>



<a name="191394276"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191394276" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191394276">(Mar 22 2020 at 12:23)</a>:</h4>
<p>this is all because we have forsaken platform-intrinsics</p>



<a name="191394281"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191394281" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191394281">(Mar 22 2020 at 12:23)</a>:</h4>
<p>which was for silly concerns such as optimizing for adding intrinsics one by one</p>



<a name="191394322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191394322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191394322">(Mar 22 2020 at 12:24)</a>:</h4>
<p>as opposed to treating it like a data entry thing</p>



<a name="191394331"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191394331" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191394331">(Mar 22 2020 at 12:24)</a>:</h4>
<p>Maybe once we have const generics we could make <code>#[rustc_args_required_const]</code> just desugar to const generics.</p>



<a name="191394343"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191394343" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191394343">(Mar 22 2020 at 12:24)</a>:</h4>
<p>try not to assume that, though</p>



<a name="191394350"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191394350" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191394350">(Mar 22 2020 at 12:25)</a>:</h4>
<p>intrinsics and inline assembly are fine, because they're builtin so we can attribute arbitrary semantics to them</p>



<a name="191394411"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191394411" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191394411">(Mar 22 2020 at 12:27)</a>:</h4>
<p>anyway I have to deal with another mess atm, and then probably just sleep</p>



<a name="191394533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191394533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191394533">(Mar 22 2020 at 12:30)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> How about forcing MIR inlining just for functions marked <code>#[rustc_args_required_const(...)]</code>? Since this attribute is only used in stdarch, we should be able to avoid all the existing issues with MIR inlining.</p>



<a name="191394783"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191394783" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191394783">(Mar 22 2020 at 12:37)</a>:</h4>
<p>Either than or monomorphizing such functions as you would with const generics. I don't really see any other solutions.</p>



<a name="191394790"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191394790" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191394790">(Mar 22 2020 at 12:37)</a>:</h4>
<p>the real solution is to get rid of it on functions with bodies</p>



<a name="191394856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191394856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191394856">(Mar 22 2020 at 12:39)</a>:</h4>
<p>how come stdarch is <em>still</em> not yet in tree? what a disaster</p>



<a name="191395071"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191395071" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191395071">(Mar 22 2020 at 12:44)</a>:</h4>
<p>anyway, opened <a href="https://github.com/rust-lang/rust/issues/70271" target="_blank" title="https://github.com/rust-lang/rust/issues/70271">https://github.com/rust-lang/rust/issues/70271</a></p>



<a name="191473699"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191473699" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Vossen <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191473699">(Mar 23 2020 at 13:39)</a>:</h4>
<p>Thank you, I will look into this!</p>



<a name="191473842"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/change%20rustc_args_required_const%20to%20per%20arg%20attribute/near/191473842" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Vossen <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/change.20rustc_args_required_const.20to.20per.20arg.20attribute.html#191473842">(Mar 23 2020 at 13:40)</a>:</h4>
<p>Does this change how I should do my implementation?</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>